import {Injectable, EventEmitter} from "@angular/core";
/**
 * 全局事件中心
 */
@Injectable()
export class EventService {
  /**
   * 导航到 root 页
   */
  static NAV_ROOT = 'nav:root';
  static RE_LOGIN = 're:login';
  static NAV_TO = 'nav:to';


  constructor(public events: EventEmitter<string>) {
  }

  publish(topic: string): void {
    return this.events.emit(topic);
  }

  subscribe(handlers: Function): any {
    return this.events.subscribe(handlers);
  }

}
